import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;

public class CsvMakeVal {
	static String PATH_INPUT = "../val";
	static String PATH_CSV = PATH_INPUT + ".csv";
	static String[][] data;
	static int ROWS = 1000990;

	public static void main(String[] args) throws Exception {
		join();
	}

	private static void join() throws Exception {
		BufferedWriter bw = new BufferedWriter(new FileWriter(PATH_CSV));

		File folder = new File(PATH_INPUT);
		File[] listOfFiles = folder.listFiles();
		BufferedReader[] bra = new BufferedReader[listOfFiles.length];

		for (int c = 0; c < listOfFiles.length; c++) {
			bra[c] = new BufferedReader(new FileReader(listOfFiles[c]));
		}

		for (int r = 0; r < 2; r++) {
			for (int c = 0; c < listOfFiles.length - 1; c++) {
				bw.write(bra[c].readLine() + ",");
			}
			bw.write(bra[listOfFiles.length - 1].readLine() + "\n");
		}

		bw.close();
	}
}
